package cn.slipi.admin.common.exception.base;

import com.fasterxml.jackson.annotation.JsonInclude;

/**
 * 自定义异常类
 * @author lee
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public final class ErrorMessage {

    private final int code;

    private final String msg;

    public ErrorMessage(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ErrorMessage(String msg) {
        this.code = 1000;
        this.msg = msg;
    }

    public ErrorMessage(BizException ex) {
        this.code = ex.getCode();
        this.msg = ex.getMsg();
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}